<include file="header" />
<link rel="stylesheet" href="/assets/store/common/css/follow.css">
<div class="wraper">
    <div class="header">
        <div class="clearfix">
            <div class="logo pull-left"><img  src="{BEESCRM:$data.logo}"/></div>
            <a href="{BEESCRM::U('base/store/userIndex',array('store_id'=>$storeId,'origin'=>$origin))}" class="iconfont icon-wo pull-right"></a>
        </div>
        <div class="search">
            <input type="text" value="" placeholder="请输入商品关键词" id="keyword"/>
            <a class="iconfont icon-search" href="#"></a>
        </div>
    </div>
    <if condition="$data['flash']">
        <div class="banner">
            <div class="swiper-container">
                <div class="swiper-wrapper">
                    <volist name="data['flash']" id="vo">
                        <div class="swiper-slide"><a href="{BEESCRM:$vo.url}"><img src="{BEESCRM:$vo.image}"/></a></div>
                    </volist>
                </div>

                <div class="swiper-pagination"></div>
            </div>
        </div>
    </if>
    <div class="product-category clearfix">
        <volist name="data['cate']" id="vo">
            <a class="category-list flex-box item-center item-col" href="{BEESCRM::U('base/store/goodsList',array('cate_id'=>$vo['cate_id'],'store_id'=>$storeId,'origin'=>$origin))}">
                <div class="category-img"><img src="{BEESCRM:$vo['image']}"/></div>
                <p class="category-name">{BEESCRM:$vo['cate_name']}</p>
            </a>
        </volist>
    </div>

    <div class="product clearfix">
        <volist name="data['goods']" id="vo">
            <a href="{BEESCRM::U('base/store/goodsdetail',array('goods_id'=>$vo['goods_id'],'store_id'=>$storeId,'origin'=>$origin))}" class="product-list">
                <div class="product-img"><img src="{BEESCRM:$vo['goods_thumb']}"/></div>
                <div class="product-mes">
                    <p class="product-name">{BEESCRM:$vo['goods_name']}</p>
                    <p class="label-box">
                        <if condition="$vo.picked eq 0">
                            <span class="product-label">快递</span>
                        <else/>
                            <span class="product-label">自提</span>
                        </if>

                        <if condition="$vo.other eq 1">
                            <span class="product-label">厂家直营</span>
                        </if>
                    </p>
                    <p class="prize">
                        <span class="new-prize">￥{BEESCRM:$vo['goods_price']}</span>
                        <span class="sale">已售{BEESCRM:$vo['sale_num']}</span>
                    </p>
                </div>
            </a>
        </volist>
    </div>

    <div class="data-loding" style="display:none">数据加载中……</div>
    <div class="picture">
    </div>

</div>
<input type="hidden" id="activitytime" value="">
<include file="commonJs" />
<include file="footer" />
<style type="text/css">
    .scrm-loadding1 {
           display: none;
           position: fixed;
           width: 100%;
           height: 100%;
           background: rgba(0, 0, 0, 0.2);
           top: 0;
           left: 0;
           right: 0;
           bottom: 0;
           z-index: 9999;
       }
    .scrm-loadding1 img{
        position: fixed;
        left: 20%;
        top: 20%;
    }
</style>
<script type="text/javascript">
    $(function(){
        var width = $(window).width();
        $('.product-img').css('height',width*0.48);
        $('.banner').css('height',width/16*9);

        var swiper = new Swiper('.banner .swiper-container', {
            pagination: '.banner .swiper-pagination',
            paginationClickable: true,
            centeredSlides: true,
            autoplay: 2500,
            autoplayDisableOnInteraction: false,
            loop: true
        });
    });
    $(document).ready(function(){
        $('.icon-search').on('click',function(){
            var keyword=$('#keyword').val();
            if(keyword){
                window.location.href="{BEESCRM::U('base/store/goodsList',array('store_id'=>$storeId,'origin'=>$origin))}/keyword/"+keyword;
            }else{
                //alert('搜索条件为空');
                $.alert('error','搜索条件不能为空');
            }
        });
    });
	
    $(document).on('click','#show-collect',function(){
    	$('#tishi').show();
    });
    
    $('.i-know').on('click',function(){
        $('#tishi').hide();
    });
</script>

<script type="text/javascript">
    $(document).ready(function(){
        var page = 2, url="{BEESCRM:$url}", flag = true;
        $(window).scroll(function(){
            if(($(window).scrollTop() + $(window).height() >= $(document).height() - 40)){
                    if(flag) {
                        flag = false;
                        $.ajax({
                            type:"GET",
                            url:url,
                            data:{'page': page},
                            dataType:'json',
                            beforeSend:function(){
                                $('.data-loding').show();//显示加载时候的提示
                            },
                            success:function(data){
                                $('.data-loding').hide();
                                var str ='';
                                if(data.status=='S'){
                                    if(data.data.length > 0) {
                                        $.each(data.data,function(i,k){
                                            str += "<a href='"+k.url+"' class='product-list flex-box item-col'>"+
                                            "<div class='product-img'>" +
                                            "<img src='"+k.goods_thumb+"'/>" +
                                            "</div>"+
                                            "<div class='product-mes'>"+
                                            "<p class='product-name'>"+k.goods_name+"</p>"+
                                            "<p class='label-box'>";
                                            if (k.picekd == 0){
                                                str += "<span class='product-label'>快递</span>";
                                            }else{
                                                str += "<span class='product-label'>自提</span>";
                                            }
                                            if (k.other == 1){
                                                str += "<span class='product-label'>厂家直营</span>";
                                            }
                                            str += "</p>"+
                                            "<p class='prize'>"+
                                            "<span class='new-prize'>￥"+k.goods_price+"</span>"+
                                            "<span class='sale'>已售"+k.sale_num+"</span>"+
                                            "</p></div></a>";
                                        });
                                        $(str).appendTo(".product > .flex-box");
                                        page++;
	                                    flag = true;
                                    } else {
                                        $('.data-loding').hide();
	                                    flag = false;
                                    }
                                }
                            }
                        });
                    }
            }
        })
    })
</script>

